Cmd

Superclass:
NSObject
Declared In:

Introduction

The base class for all command classes (Esc, TSC, cpcl, and pin)



Methods

-Append:
-Append:len:

Add instructions to the cache for use in the last call to GetCmd

-Clear
-GetBarCodeCmd:codeType:scode:codeError:
-GetBeepCmd:interval:
-GetBitMapCmd:image:
-GetBitMapCmdExt:image:
-GetBlackLabelPlusCmd:
-GetBlackLabelSubCmd:
-GetCmd
-GetCodePageCmd:
-GetCompressedBitMapCmd:image:
-GetCRCmd
-GetCutPaperCmd:
-GetFeedAndCutPaperCmd:FeedDistance:
-GetHeaderCmd
-GetHeaderCmd:
-GetLFCmd
-GetLFCRCmd
-GetNullData
-GetOpenDrawerCmd:startTime:endTime:
-GetPrintEndCmd
-GetPrintEndCmd:
-GetSelftestCmd
-GetSetPointCmdByX:andY:
-GetTextCmd:text:
-ImportData:
-MoveData:dest:index:
-MoveData:ibegin:len:dest:dindex:

Append:


-(void)Append:(NSData *)data; 
Parameters
data
Discussion

* Add instructions to the cache for use in the last call to GetCmd


Append:len:


Add instructions to the cache for use in the last call to GetCmd

-(void)Append:(Byte*)bytes len:(NSInteger)len; 
Parameters
bytes

Instructions to be added

len

Instruction length

Discussion

*


Clear


-(void)Clear; 
Discussion

Clear the cache data


GetBarCodeCmd:codeType:scode:codeError:


-(NSData *_Nullable) GetBarCodeCmd:(BarcodeSetting *_Nonnull)barcodeset 
        codeType:(BarcodeType)codeType scode:(nonnull NSString * )scode 
        codeError:(PrinterCodeError *_Nonnull)codeError; 
Parameters
barcodeset

Barcode settings

codeType

Barcode type

scode

Barcode content

codeError

error code

Return Value

NSData

Discussion

Get barcode instructions


GetBeepCmd:interval:


- (NSData *) GetBeepCmd:(Byte)level interval:(Byte)interval; 
Parameters
level

frequency

interval

(single time) interval*100 ms

Discussion

Beep sound


GetBitMapCmd:image:


-(NSData *) GetBitMapCmd:(BitmapSetting *) bitmapSetting 
        image:(UIImage *) image; 
Parameters
bitmapSetting

image setting

image

image

Return Value

NSData

Discussion

Get the picture print order


GetBitMapCmdExt:image:


-(NSData *) GetBitMapCmdExt:(BitmapSetting *) bitmapSetting 
        image:(UIImage *) image; 
Parameters
bitmapSetting

image setting

image

image

Return Value

NSData

Discussion

Get the picture print order(Used for the Esc command, when printing long images, and connected with wifi, usb)


GetBlackLabelPlusCmd:


- (NSData *)GetBlackLabelPlusCmd:(int)plus; 
Discussion

set the black label step more plus millimeter


GetBlackLabelSubCmd:


- (NSData *)GetBlackLabelSubCmd:(int)sub; 
Discussion

set the black label step less sub millimeter


GetCmd


-(NSData *_Nullable) GetCmd; 
Return Value

NSData

Discussion

*Get all the instructions generated by calling the Append method


GetCodePageCmd:


-(NSData *)GetCodePageCmd:(NSString *)codepage; 
Discussion

codepage set the codepage for ESC


GetCompressedBitMapCmd:image:


-(NSData *) GetCompressedBitMapCmd:(BitmapSetting *) bitmapSetting 
        image:(UIImage *) image; 
Parameters
bitmapSetting

image setting

image

image

Return Value

NSData

Discussion

Get the compressed picture print order (for esc command, only few printer support), if you want to use it please contact technical support first


GetCRCmd


-(NSData *) GetCRCmd; 
Return Value

NSData

Discussion

Get print carriage return instruction


GetCutPaperCmd:


- (NSData *) GetCutPaperCmd:(CutterMode) cutterMode; 
Parameters
cutterMode

Cutter mode

Discussion

Paper cutting control command


GetFeedAndCutPaperCmd:FeedDistance:


- (NSData *) GetFeedAndCutPaperCmd:(BOOL)isFeed FeedDistance:(Byte)FeedDistance; 
Parameters
isFeed

YES: Part cut paper NO: Feed, and cut some paper (keep a bit not cut)

FeedDistance

Feed distance [n + 0.125 mm]

Discussion

Select the cut mode and cut the paper


GetHeaderCmd


-(NSData *) GetHeaderCmd; 
Discussion

Get initialization command header


GetHeaderCmd:


-(NSData *) GetHeaderCmd:(CommonSetting *_Nonnull)ComSetting; 
Discussion

Get initialization command header, and set parameters according to ComSetting


GetLFCmd


-(NSData *) GetLFCmd; 
Return Value

NSData

Discussion

Get line feed instruction


GetLFCRCmd


-(NSData *_Nonnull) GetLFCRCmd; 
Return Value

NSData

Discussion

Get the carriage return line feed instruction


GetNullData


-(NSData *_Nullable) GetNullData; 
Return Value

NSData

Discussion

Get empty NSData


GetOpenDrawerCmd:startTime:endTime:


- (NSData *) GetOpenDrawerCmd:(Byte)DrawerNumber startTime:(Byte)pulseStartTime 
        endTime:(Byte)PulseEndTime; 
Parameters
DrawerNumber

0: (Drawer pin 2) 1: (Drawer pin 5) default:0

pulseStartTime

default:5

PulseEndTime

default:0

Discussion

Open the cashbox


GetPrintEndCmd


-(NSData *_Nullable) GetPrintEndCmd; 
Return Value

NSData

Discussion

Get the end of the print order (Pincmd is used for rewinding, TSC, CPCL is to send print commands, ESC: carriage return line feed command)


GetPrintEndCmd:


-(NSData *_Nullable) GetPrintEndCmd:(NSInteger)copies; 
Parameters
copies

Print copies (for TSC, other calls equal to GetPrintEndCmd)

Return Value

NSData

Discussion

Get the end of the print order (Pincmd is used for rewinding, TSC, CPCL is to send print commands, ESC: carriage return line feed command)


GetSelftestCmd


-(NSData *) GetSelftestCmd; 
Return Value

NSData

Discussion

Get instructions to print a self-test page


GetSetPointCmdByX:andY:


- (NSData *)GetSetPointCmdByX:(int)x andY:(int)y; 
Discussion

set the start X and Y axis


GetTextCmd:text:


-(NSData *) GetTextCmd:(TextSetting *)textSetting text:(NSString *)text; 
Parameters
textSetting

Text setting

text

Enter the text

Return Value

Return command data

Discussion

By textSetting get the corresponding text instruction


ImportData:


-(NSData *) ImportData:(nonnull NSString*) data; 
Parameters
data

Data to be generated

Return Value

Returns data of the specified encodingType encoding

Discussion

Generate data of the specified encodingType encoding


MoveData:dest:index:


-(void)MoveData:(NSData *)source dest:(Byte *)dest index:(NSInteger *)index; 
Parameters
source

source data

dest

dest data

index

Current index

Discussion

The value of the source assigned to dest, dest from the index assignment, each assigned a byte index will increase by one


MoveData:ibegin:len:dest:dindex:


-(void)MoveData:(Byte *)source ibegin:(NSInteger)ibegin len:(NSInteger) len 
        dest:(Byte *)dest dindex:(NSInteger *)dindex; 
Parameters
source

source data

ibegin

start index

dest

dest data

dindex

Current index

Discussion

The source value (starting from ibegin to length len) assigned to dest, dest from the index assignment, each assigned a byte index will increase by 1


Properties

barcodeBufferSize
encodingType

barcodeBufferSize


@property (nonatomic) NSInteger barcodeBufferSize; 
Discussion

After the end of the bar code, to print a few end characters 0x00, the default is 1


encodingType


@property (nonatomic) EncodingType encodingType; 
Discussion

Encoding Type